package com.netease.nie.base.threadpool;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * 异步线程池
 * @author KingsHunter
 * @createDate July 8th,2016
 *
 */
public class MultiExecutorTask {
	
	private ThreadPoolExecutor es = (ThreadPoolExecutor) Executors.newFixedThreadPool(4);
	
	private static MultiExecutorTask executorTask = new MultiExecutorTask();
	
	private MultiExecutorTask() {
	}
	
	public static MultiExecutorTask getInstance() {
		return executorTask;
	}
	
	public void executer(Runnable task) {
		try {
			if (!es.isShutdown())
				es.execute(task);
		} catch (Exception e) {
			es.remove(task);
		}
		
	}
}
